package cn.edu.zafu.bigdata.yuyini;

class Animal {// 定义父类 Animal
        public void makeSound() {
            System.out.println("Animal sound");
        }
    }

    // 定义子类 Dog，继承自 Animal
    class Dog extends Animal {
        @Override
        public void makeSound() {
            System.out.println("Woof!");
        }
    }

    // 定义子类 Cat，继承自 Animal
    class Cat extends Animal {
        @Override
        public void makeSound() {
            System.out.println("Meow!");
        }
    }

public class Animal_Test {
    public static void main(String[] args) {
        // 创建 Dog 和 Cat 对象
        Dog dog = new Dog();
        Cat cat = new Cat();

        // 调用它们的 makeSound 方法
        dog.makeSound();
        cat.makeSound();
    }
}
